package algorithms.sorting


import redirectSystemIn
import redirectSystemOut
import org.junit.jupiter.api.Test
import java.util.*

class QuickSortTests {
    @Test
    fun quickSortTest() {
        redirectSystemIn(this.javaClass) {
            val scan = Scanner(System.`in`)
            redirectSystemOut {
                while (scan.hasNextLine()) {

                    val n = scan.nextLine().trim().toInt()

                    val arr = scan.nextLine().split(" ").map { it.trim().toInt() }.toTypedArray()

                    val result = quickSort(arr)

                    println(result.joinToString(" "))

                    it.add(scan.nextLine().trim())
                }
            }
        }
    }
}